package com.aba.cms.teacher;

import java.util.List;

public class TeacherService {
    private TeacherDAO teacherDAO = new TeacherDAO();

    // 添加教师
    public void addTeacher(Teacher teacher) {
        // 可以添加业务逻辑验证，如邮箱格式验证
        teacherDAO.addTeacher(teacher);
    }

    // 更新教师信息
    public void updateTeacher(Teacher teacher) {
        // 可以添加业务逻辑验证
        teacherDAO.updateTeacher(teacher);
    }

    // 根据ID获取教师
    public Teacher getTeacherById(int id) {
        return teacherDAO.getTeacherById(id);
    }

    // 获取所有教师
    public List<Teacher> getAllTeachers() {
        return teacherDAO.getAllTeachers();
    }

    // 根据姓名查询教师
    public List<Teacher> searchTeachersByName(String name) {
        return teacherDAO.searchTeachersByName(name);
    }
}    